package com.lglbc.arthasdemo;

import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class IndexController {
    @RequestMapping("/test")
    public String test(@RequestParam(required = false) String a){
        String b=null;
        if (!StringUtils.hasText(a)){
            b = handleEmpty(a);
        }else if(a.equals("1")){
            b = handle1(a);
        }else{
            return "success";
        }

        if (StringUtils.hasText(b)){
            return "hello "+b;
        }
        return "null";
    }

    private String handle1(String a) {
        return "success";
    }

    private String handleEmpty(String a) {
        return "empty";
    }


}
